#ifndef _LIBIO_H_
#define _LIBIO_H_
/**
  \file libCommon.h
  \brief common local APIs
*/

#define     CLEAR(a)    memset(a,'\0',sizeof(a))    ///< a easier memset Define..
/**
  \brief A read operation may return less than asked for, even though we have not encountered
  the end of file. This is not an error, and we should simply continue reading from the device.

   @param fd              descriptor to read
   @param ptr             data buffer
   @param n               data buffer length
   @return bytes which success to read,error -1;

*/
ssize_t readn(int fd, void *ptr, size_t n);
/**
  \brief A write operation can also return less than we specified.
  This may be caused by flow control constraints by downstream modules,
  for example. Again, it's not an error, and we should continue writing the remainder of the data.
  (Normally, this short return from a write occurs only with a nonblocking descriptor or if a signal is caught.)

  @param fd             descriptor to write
  @param ptr             data buffer
  @param n               data buffer length
  @return bytes which success to write,error -1;
*/
ssize_t writen(int fd, const void *ptr, size_t n);

int chk_file_exist(char *path);

#endif
